<script setup lang="ts">
import { ref } from 'vue'
import { RouterView } from 'vue-router'
import Sidebar from './components/Sidebar.vue'
import TitleBar from './components/TitleBar.vue'
import SplashScreen from './components/SplashScreen.vue'
import UpdateChecker from './components/UpdateChecker.vue'
import 'remixicon/fonts/remixicon.css'

const isLoading = ref(true)

const handleLoaded = () => {
  isLoading.value = false
}
</script>

<template>
  <SplashScreen v-if="isLoading" @loaded="handleLoaded" />
  <div v-else class="app-container">
    <TitleBar class="flex-none" />
    <div class="main-content">
      <Sidebar class="flex-none" />
      <main class="flex-1 overflow-auto p-2">
        <RouterView />
      </main>
    </div>
    <UpdateChecker />
  </div>
</template>

<style>
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
}

body {
  background-color: transparent;
}

#app {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

.app-container {
  width: 100%;
  height: 100%;
  background-color: hsl(var(--b1));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  /* 移除最小高度限制 */
  /* min-height: 100vh; */
  /* 使用transform确保渲染层级 */
  transform: translateZ(0);
  /* 确保内容不会溢出 */
  position: absolute;
  inset: 0;
  margin: 0;
  /* 添加边框替代阴影 */
  border: 1px solid transparent;
}

/* 确保所有子元素也有相同的背景色 */
.app-container > * {
  background-color: hsl(var(--b1));
}

/* 添加主容器样式 */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background-color: hsl(var(--b1));
}
</style>